package com.glasses.business.adapter;

import android.app.Activity;
import android.support.v7.widget.RecyclerView;
import android.view.View;
import android.widget.TextView;

import com.facebook.drawee.view.SimpleDraweeView;
import com.glasses.business.R;
import com.glasses.business.base.MyBaseAdapter;
import com.glasses.business.entity.MsgList;
import com.glasses.business.entity.User;

import java.util.List;

import butterknife.ButterKnife;
import butterknife.InjectView;

/**
 * 作者 ： hjb
 * 时间 ： 2016/9/30.
 */

public class MessageAdapter extends MyBaseAdapter<MsgList, MessageAdapter.ViewHolder> {


    public MessageAdapter(Activity context, List<MsgList> data) {
        super(context, data);
    }

    @Override
    protected ViewHolder getViewHolder() {
        return new ViewHolder(mInflater.inflate(R.layout.item_message, null));
    }

    @Override
    protected void onBindViewHolder_(ViewHolder holder, int position) {
        if (data != null&&data.size()>0) {
            MsgList msgList = data.get(position);
            holder.msgContent.setText(msgList.getContent());
            holder.msgName.setText(msgList.getTitle());
        }
    }

    static class ViewHolder extends RecyclerView.ViewHolder {

        @InjectView(R.id.msgHeadImg)
        SimpleDraweeView msgHeadImg;
        @InjectView(R.id.msgName)
        TextView msgName;
        @InjectView(R.id.msgContent)
        TextView msgContent;

        ViewHolder(View view) {
            super(view);
            ButterKnife.inject(this, view);
        }
    }
}
